/******************************************************************************
* This file is part of is32p218 platform,
* Copyright (c) 2009 HangZhou InfoStrong CO.,LTD. All rights reserved.
* This software may only be used under the terms of a valid, current,
* end user license from InfoStrong.
* Nothing else gives you the right to use this software.   
*
* Name:   os_flg.h
* Desc:   OS Flag header file
* Author: Jerry
* Date:   2009-10-19
* Note:   
* History:
*
******************************************************************************/
#include "isOS.h"
#include "os_cfg.h"

#ifndef __OS_FLG_H__
#define __OS_FLG_H__

#if (OS_FLG_EN ==1 )

#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------
 * MACROS AND DEFINITIONS
 *----------------------------------------------------------*/

typedef struct _isOS_FLAG
{
   LIST_QUE wait_queue;
   isOS_S32 attr;               //-- Eventflag attribute
   isOS_U32 pattern;   //-- Initial value of the eventflag bit pattern
   isOS_S32 id_event;           //-- ID for verification(is it a event or another object?)
                             // All events have the same id_event magic number (ver 2.x)
#if OS_FLG_NAME_EN
   isOS_S8 *pname;
#endif
}isOS_FLG;



// Event flags constants
#define  FLG_ATTR_SINGLE           1
#define  FLG_ATTR_MULTI            2

#define  FLG_MODE_CLR              4
#define  FLG_MODE_ORW              8
#define  FLG_MODE_ANDW          0x10


/*-----------------------------------------------------------*/

/*
 * Inside this file xFlgHandle is a pointer to a isOS_FLG structure.
 * 
 */

isOS_S32 isOS_FlgCreate(isOS_FLG * evf,
                      isOS_S32 attr,
                      isOS_U32 pattern,
					  isOS_S8 *pname
                     );
isOS_S32 isOS_FlgDelete(isOS_FLG * evf); //-- v.2.0
isOS_S32 isOS_FlgWait(isOS_FLG * evf,
                    isOS_U32 wait_pattern,
                    isOS_S32 wait_mode,
                    isOS_U32 * p_flags_pattern,
                    isOS_U32 timeout);
isOS_S32 isOS_FlgSet(isOS_FLG * evf, isOS_U32 pattern);
isOS_S32 isOS_FlgClear(isOS_FLG * evf, isOS_U32 pattern);

#ifdef __cplusplus
}
#endif

#endif /* #if (OS_FLG_EN ==1 ) End*/
#endif /* __OS_FLG_H__ End */


